package md.lanjing.com.module_deal_center.contact;

import android.content.Context;


import com.lxh.baselibray.mvp.BasePresent;
import com.lxh.baselibray.mvp.IBaseView;
import com.lxh.baselibray.net.NetCallBack;
import com.lxh.baselibray.net.ServiceGenerator;
import com.lxh.baselibray.util.ToastUtils;


import md.lanjing.com.module_deal_center.api.DealApiService;
import md.lanjing.com.module_deal_center.bean.DealCenterBuyListRequest;
import md.lanjing.com.module_deal_center.bean.DealCenterBuyListResponce;
import retrofit2.Call;
import retrofit2.Response;

public class DealCenterBuyContact {
    public static class DealCenterBuyPresent extends BasePresent<IDealCenterBuyView> {
        public void getBuyList(final Context context, String type, int pageNum){
            DealApiService service= ServiceGenerator.createService(DealApiService.class);
            DealCenterBuyListRequest request=new DealCenterBuyListRequest(type,pageNum);
            service.getDealCenterBuyList(request).enqueue(new NetCallBack<DealCenterBuyListResponce>() {
                @Override
                public void onSuccess(Call<DealCenterBuyListResponce> call, Response<DealCenterBuyListResponce> response) {
                    if (getView()!=null){
                        getView().getBuyListData(response);
                    }
                }

                @Override
                public void onFailed() {
                    ToastUtils.showLongToast(context,"网络请求异常");
                }
            });

        }




    }
    public interface IDealCenterBuyView extends IBaseView {
        void getBuyListData(Response<DealCenterBuyListResponce> response);

    }
}
